<?php
use yii\helpers\Url;
use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\NewsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'News';
$this->params['breadcrumbs'][] = $this->title;
?>

<div class="ibox float-e-margins" id="bx_search_form">
    <div class="ibox-title">
      <?php echo \backend\widgets\ActionMenuWidget::widget(); ?>
      <div class="ibox-tools">
        <a class="collapse-link">
          搜索
          <i class="fa fa-chevron-down"></i>
        </a>
      </div>
    </div>
    <div class="ibox-content" style="display: none">
      <?php  echo $this->render('_search', ['model' => $searchModel]); ?>
    </div>
</div>

<div class="ibox-content">

    <?= GridView::widget([
        'options' => ['class' => 'grid-view', 'id' => 'grid'],
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            //['class' => 'yii\grid\SerialColumn'],
            [
            'class' => 'yii\grid\CheckboxColumn',
            'multiple'=>false,
            'name' => 'grid',
            'checkboxOptions'=>['class'=>'grid']
            ],

            'id',
            'catid',
            [
              'attribute'=>'catid',
              'value'=>'cat.title'
            ],
            'title',
            //'image',

          [
            'attribute'=>'image',
            'format' => 'raw',
            'value' => function($model){
              return Html::img($model->image);
            }
          ],

           // 'keywords',
            // 'description',
            // 'content:ntext',
            // 'listorder',
             //'created_at:date',
          [
            //'attribute' => 'created_at',
            //'label'=>'更新时间',
            'value'=>function($model){
              return  date('Y-m-d H:i:s',$model->created_at);
            },
            ],
            // 'updated_at',
            // 'deleted',
            // 'source',
            // 'click_num',

           // ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>

</div>